﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace RMSoftware.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            //BusinessObjects.Project project = new BusinessObjects.Project();
            //System.Diagnostics.Debug.WriteLine(project.Retrieve().ElementAt(1).Person.FirstName);
            //System.Diagnostics.Debug.WriteLine(project.Retrieve().ElementAt(1).ProjectsRisks.Count);

            //BusinessObjects.Person person = new BusinessObjects.Person();

            //foreach (var p in person.Retrieve())
            //{
            //    System.Diagnostics.Debug.WriteLine(p.LastName + " " + p.Role.Title + " " + p.Measures.Count);
            //}


            if (User.IsInRole("ProjectManager"))
            {
                return RedirectToAction("ViewList", "Project");
            }
            else if (User.IsInRole("TeamMember"))
            {
                return RedirectToAction("ViewDetailsByUsername", "Person", new { username = User.Identity.Name });
            }
            else
            {
                return RedirectToAction("LogOn", "Account");
            }
        }

        public ActionResult About()
        {
            return View();
        }
    }
}
